<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 创建一个数组
        var arr = [1,2,3,2,2,2,4,2,5];

        // 去除数组中重复的数字
        for (var i = 0; i < arr.length; i++){
            for (var j = i+1; j < arr.length; j++){
                // 如果元素相同，则删除
                while (arr[j] == arr[i]){
                    arr.splice(j,1);
                }
            }
        }


        // 输出数组,结果：1,2,3,4,5,6
        console.log(arr);
    </script>
</head>
<body>
    
</body>
</html>